Skip to content

feat(knowledge): Redis memory graph schema — entity/relation indexes and chat integration (#3385)#3608

Closed
mrveiss wants to merge 2 commits intoDev_new_guifrom
issue-3385
Closed

feat(knowledge): Redis memory graph schema — entity/relation indexes and chat integration (#3385)#3608
mrveiss wants to merge 2 commits intoDev_new_guifrom
issue-3385

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Apr 6, 2026

Closes #3385

Implements Week 1 foundation from docs/database/REDIS_MEMORY_GRAPH_SPECIFICATION.md.

Summary

  • schema.py — Redis key patterns (memory:entity:, memory:relations:out/in:), index names, ENTITY_TYPES, RELATION_TYPES, ensure_indexes() (issues FT.CREATE memory_entity_idx and FT.CREATE memory_fulltext_idx matching spec exactly)
  • graph_store.pycreate_entity(), get_entity(), create_relation() (bidirectional), get_outgoing_relations(), get_incoming_relations(), traverse_relations() (BFS, depth-limited, cycle-safe)
  • __init__.py — Package re-exports public API

Tests

28 unit tests, all passing (graph_store_test.py). Redis fully mocked.

Design decisions

  • Uses database="knowledge" (DB 1) — consistent with existing autobot_memory_graph package
  • All functions standalone async for testability
  • Key patterns exactly match spec

Out of scope (Weeks 2–4)

Multi-hop query patterns, conversation migration, and chat integration will be addressed in follow-up issues.

@mrveiss
Copy link
Copy Markdown
Owner Author

mrveiss commented Apr 6, 2026

Review fixes applied ✓

  • Critical — hardcoded "autobot" user_id removed from create_entity() base metadata
  • Critical_init_relation_doc replaced EXISTS+SET two-step with atomic JSON.SET ... NX; test mock updated to handle NX flag
  • Critical__init__.py unified to export both graph_store/schema symbols and query_processor/hybrid_scorer symbols (with try/except ImportError guard for the latter until feat(knowledge): memory graph semantic search — query processor and hybrid scoring (#3384) #3609 merges)
  • Minor — docstring corrected from "Redis DB 2" to "Redis DB 1 (knowledge)"
  • Bonusisinstance(entity, Exception) narrowed to isinstance(entity, BaseException) to fix type checker warning in traverse_relations

All 28 tests passing.

mrveiss added a commit that referenced this pull request Apr 6, 2026
Sync tasks lacked notify — service ran stale code after rsync, causing 502
on /api/health and login failures. All three sync tasks now notify handlers.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@mrveiss
Copy link
Copy Markdown
Owner Author

mrveiss commented Apr 6, 2026

Superseded by #3616 which consolidates all memory graph code (including semantic search) into the canonical autobot_memory_graph package. A compat shim at knowledge/memory_graph/__init__.py re-exports the unified API.

@mrveiss mrveiss closed this Apr 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

✅ SSOT Configuration Compliance: Passing

🎉 No hardcoded values detected that have SSOT config equivalents!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant